<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="http://www.baidu.com/s" method="get" >
        <input type="text" name="wd">
        <button>测试</button>
    </form>

    <hr>
    <a href="http://atguigu.com">尚硅谷</a>
    
    <script>
        let form = document.querySelector('form');
        let a = document.querySelector('a');

        form.onsubmit = function(e){
            //阻止表单提交
            e.preventDefault();
        }
        
        a.onclick = function(e){
            e.preventDefault();
        }

        //阻止右键菜单
        window.oncontextmenu = function(e){
            e.preventDefault();
        }

    </script>
</body>
</html>